#ifndef _VL_C_COMPILE_SUPPORT_2__H_
#define _VL_C_COMPILE_SUPPORT_2__H_

#include "support/vl_support.h"
#include "vl_c_config_def.h"

/**
 * @Author: CimZzz
 * @Date: 2022-06-28 11:41:13
 * 
 * 跨平台兼容宏定义
 */
#if defined __APPLE__ || defined __MACH__
	#define VL_C_COMPILE_SYS_ROOT_KEY "-isysroot "
	#define VL_C_COMPILE_DYM_KEY "-shared"
	#define VL_C_COMPILE_DYM_POSTFIX_KEY ".dylib"
#elif defined __linux__ || defined __unix || defined __unix__
	#define VL_C_COMPILE_SYS_ROOT_KEY "--sysroot="
	#define VL_C_COMPILE_DYM_KEY "-shared"
	#define VL_C_COMPILE_DYM_POSTFIX_KEY ".so"
#elif defined _WIN32 || defined _WIN64
	#define VL_C_COMPILE_SYS_ROOT_KEY "--sysroot="
	#define VL_C_COMPILE_DYM_KEY "-shared"
	#define VL_C_COMPILE_DYM_POSTFIX_KEY ".dll"
#else
	#error Not support operator system!
#endif

namespace VL {

/**
 * @Author: CimZzz
 * @Date: 2022-08-22 13:48:23
 * 
 * C / C++ 编译支持
 */
class CCompileSupport : public VLSupport {
public:
	/**
	 * @Author: CimZzz
	 * @Date: 2022-08-22 13:51:59
	 * 
	 * 构造函数
	 */
	explicit CCompileSupport();

	/**
	 * @Author: CimZzz
	 * @Date: 2022-08-19 15:53:54
	 * 
	 * 执行动作
	 * 
	 * @param env 环境变量
	 */
	virtual void doAction(VLEnv* env);

private:
	/**
	 * @Author: CimZzz
	 * @Date: 2022-08-05 19:37:42
	 * 
	 * 加载源文件中的头文件
	 * 
	 * @param sourceFile 源文件指针
	 * @param headerPool 头文件池指针
	 * @param projectPropPtr 项目属性指针
	 * @param configBundlePtr 配置数据指针
	 * @param buffer 字节缓冲区指针
	 * @param headerVector 头文件列表
	 * 
	 * @return 如果加载成功返回 true
	 */
	bool loadSourceHeader(
		const std::shared_ptr<FileWrapper>& sourceFile,
		std::shared_ptr<FilePool>& headerPool,
		const std::shared_ptr<ProjectProperties>& projectPropPtr,
		const std::shared_ptr<CConfigBundle>& configBundlePtr,
		Buffer* buffer,
		std::vector<std::shared_ptr<FileWrapper>>& headerVector
	);
};


}

#endif // _VL_C_COMPILE_SUPPORT_2__H_
